<?php

namespace App\Http\Controllers;

use App\Models\Commander;
use App\Models\CommanderAudit;
use App\Models\UserInfo;
use App\Services\AuditRegimentalAdd;
use Illuminate\Http\Request;

class RegimentalController extends Controller
{
    /**
     * 添加团长审核
     */
    public function auditRegimental(Request $request)
    {
        $data = $request->post();
        $uid = $data['uid'];
        $commander = Commander::where('uid',$uid)->first();
        if($commander){
            return \App\Services\Request::fail(1000,'该用户正在审核中','');
        }
        $commanderAudit = CommanderAudit::where('uid',$uid)->first();
        if($commanderAudit){
            return \App\Services\Request::fail(1000,'该用户是团长无法进行申请','');
        }
        $res = AuditRegimentalAdd::auditRegimentalAdd($data);
        if($res){
            return \App\Services\Request::success(200,'申请团长发送成功','');
        }
    }
}
